<template>
  <div>
    <my-navbar></my-navbar>
    <div class="cinemas-list">
      <div>全城<van-icon name="arrow-down" size="6px" /></div>
      <div>App定票<van-icon name="arrow-down" size="6px" /></div>
      <div>最近去过<van-icon name="arrow-down" size="6px" /></div>
    </div>
    <div
      class="cinemas-list-warp"
      v-for="(item, index) in cinema.cinemaData"
      :key="index"
    >
      <div class="left">
        <p>{{ item.name }}</p>
        <p>{{ item.address }}</p>
      </div>
      <div class="right">
        <p>￥{{ item.lowPrice.toString().substr(0, 2) }}起</p>
        <p>距离未知</p>
      </div>
    </div>
  </div>
</template>
<script setup>
import MyNavbar from "../components/MyNavbar.vue";
import { getCinemas } from "../api/locationApi";
import { reactive, onMounted } from "vue";
const cinema = reactive({
  cinemaData: [],
});

onMounted(async () => {
  const { data: res } = await getCinemas();
  cinema.cinemaData = res.cinemas;
});
</script>
<style lang="scss" scoped>
.header,
.cinemas-list {
  display: flex;
  height: 45px;
  justify-content: space-between;
  align-items: center;
  p {
    flex: 1;
    height: 49px;
    font-size: 13px;
    text-align: center;
    line-height: 49px;
  }
  p:nth-child(2) {
    flex: 5;
    font-size: 18px;
  }
  div {
    flex: 1;
    font-size: 14px;
    text-align: center;
    height: 45px;
    line-height: 45px;
  }
}
.cinemas-list-warp {
  height: 75px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  p {
    font-size: 15px;
    margin-top: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  p:nth-child(2) {
    font-size: 12px;
    color: #797d82;
  }
  .left {
    width: 65%;
  }
  .right {
    width: 15%;
    p:nth-child(1) {
      color: #ff5f16;
    }
  }
}
</style>
